package com.zj.study.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.zj.study.service.UserService;
import com.zj.study.service.impl.UserServiceImpl;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ZhaoJiu
 * @desc MybatisPlus全局配置
 * @since 2021/6/25 13:52
 */
@Configuration
@MapperScan("com.zj.study.mapper")
public class MybatisPlusConfig {

  /**
   * 分页插件
   *
   * @return 分页插件的实例
   */
  @Bean
  public PaginationInterceptor paginationInterceptor() {
    return new PaginationInterceptor();
  }

  /**
   * 乐观锁插件
   *
   * @return 乐观锁插件的实例
   */
  @Bean
  public OptimisticLockerInterceptor optimisticLockerInterceptor() {
    return new OptimisticLockerInterceptor();
  }


}
